package com.snake.springboot.authority.service.assembler;

import com.snake.springboot.authority.dao.mybatis.entity.AuthMenuInterfaceDO;
import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 类 {@code MenuInterfaceAssembler}  <br> .
 * <p>权限菜单与接口资源关联组装器
 * 创建时间：2024/6/1 15:48
 *
 * @author Yzhui
 * @see
 */
public class AuthMenuInterfaceAssembler {

    public static List<AuthMenuInterfaceDO> assembleAuthMenuInterfaceDOList(List<String> interfaceIds, String menuId) {
        if(CollectionUtils.isNotEmpty(interfaceIds)) {
            List<AuthMenuInterfaceDO> list = new ArrayList<>(interfaceIds.size());
            AuthMenuInterfaceDO item = null;
            for (String i: interfaceIds){
                item = new AuthMenuInterfaceDO(menuId, i);
                list.add(item);
            }
            return list;
        } else {
            return new ArrayList<>(1);
        }
    }
}
